﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ddcCajamarca.BusinessEntities.Administracion;
using ddcCajamarca.BusinessEntities.AgendaCultural;
using ddcCajamarca.BusinessEntities.Directorio;
using ddcCajamarca.BusinessEntities.Documentos;
using ddcCajamarca.BusinessEntities.Post;
using ddcCajamarca.Repository.Mapping;
using ddcCajamarca.Repository.Mapping.Documentos;

namespace ddcCajamarca.Repository
{
    public partial class ddcCajamarcaContext : DbContext
    {
        public ddcCajamarcaContext()
        {
           //Database.SetInitializer<ddcCajamarcaContext>(null);
            Database.SetInitializer<ddcCajamarcaContext>(new DropCreateDatabaseIfModelChanges<ddcCajamarcaContext>());
            //Database.SetInitializer<ddcCajamarcaContext>(new DropCreateDatabaseAlways<ddcCajamarcaContext>());
            //Database.SetInitializer<ddcCajamarcaContext>(new CreateDatabaseIfNotExists<ddcCajamarcaContext>());
        }

        //AREA DE REGISTROS DE DOCUMENTOS.
        public DbSet<RDocumento> RDocumentos { get; set; }
        public DbSet<Area> Areas { get; set; }
        public DbSet<TDocumentario> TDocumentarios { get; set; }
        public DbSet<DetalleRegistro> DetalleRegistros { get; set; }

        public DbSet<Ambiente> Ambientes { get; set; }
        public DbSet<Evento> Eventos { get; set; }
        public DbSet<DetalleEvento> DetalleEventoOrganizadores { get; set; }
        public DbSet<Imagen> Imagenes { get; set; }
        public DbSet<TipoEvento> TipoEventos { get; set; }
        public DbSet<ActividadEvento> ActividadesEvent { get; set; }
        public DbSet<Actividad> Actividades { get; set; }
        public DbSet<DetalleOrganizacionContacto> DetalleOrganizacionContactos { get; set; }
        public DbSet<DetallePersonaActividad> DetallePersonaActividades { get; set; }
        public DbSet<Infraestructura> Infraestructuras { get; set; }
        public DbSet<Organizacion> Organizaciones { get; set; }
        public DbSet<SubTipoInstitucion> SubTipoInstituciones { get; set; }
        public DbSet<Persona> Personas { get; set; }
        public DbSet<Profesion> Profesiones { get; set; }
        public DbSet<Vocativo> Vocativos { get; set; }
        public DbSet<TipoDocumento> TipoDocumentos { get; set; }
        public DbSet<TipoOrganizacion> TipoOrganizaciones { get; set; }
        public DbSet<Ubigeo> Ubigeos { get; set; }
        public DbSet<NotaInformativa> NotasInformativas { get; set; }
        public DbSet<Comentario> Comentarios { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //AREA DE REGISTROS DE DOCUMENTOS.
           modelBuilder.Configurations.Add(new RDocumentoMap());
           modelBuilder.Configurations.Add(new AreaMap());
           modelBuilder.Configurations.Add(new TDocumentarioMap());
           modelBuilder.Configurations.Add(new DetalleRegistroMap());

            modelBuilder.Configurations.Add(new AmbienteMap());
            modelBuilder.Configurations.Add(new EventoMap());
            modelBuilder.Configurations.Add(new DetalleEventoMap());
            modelBuilder.Configurations.Add(new ImagenMap());
            modelBuilder.Configurations.Add(new TipoEventoMap());
            modelBuilder.Configurations.Add(new ActividadEventoMap());
            modelBuilder.Configurations.Add(new ActividadMap());
            modelBuilder.Configurations.Add(new DetalleOrganizacionContactoMap());
            modelBuilder.Configurations.Add(new DetallePersonaActividadMap());
            modelBuilder.Configurations.Add(new InfraestructuraMap());
            modelBuilder.Configurations.Add(new OrganizacionMap());
            modelBuilder.Configurations.Add(new SubTipoInstitucionMap());
            modelBuilder.Configurations.Add(new PersonaMap());
            modelBuilder.Configurations.Add(new TipoDocumentoMap());
            modelBuilder.Configurations.Add(new ProfesionMap());
            modelBuilder.Configurations.Add(new VocativoMap());
            modelBuilder.Configurations.Add(new TipoOrganizacionMap());
            modelBuilder.Configurations.Add(new UbigeoMap());
            modelBuilder.Configurations.Add(new NotaInformativaMap());
            modelBuilder.Configurations.Add(new ComentarioMap());
        }
    }
}
